src: add fast api call to push span strings#283
Closed
santigimeno wants to merge 2 commits intonode-v22.x-nsolid-v5.xfrom
Closed
src: add fast api call to push span strings#283santigimeno wants to merge 2 commits intonode-v22.x-nsolid-v5.xfrom
santigimeno wants to merge 2 commits intonode-v22.x-nsolid-v5.xfrom
Conversation
RafaelGSS
approved these changes
Apr 1, 2025
This commit introduces performance optimizations for tracing span attribute handling by adding two new fast API calls: 1. FastPushSpanDataString - Optimized version of the existing string push method 2. FastPushSpanDataString3 - New method to efficiently handle three string values in a single call Key changes include: - Avoided JavaScript string concatenation which produces non-flattened V8 strings that cannot trigger fast API paths - Implemented direct passing of individual string components to C++ where concatenation can happen after the fast API boundary - Refactored HTTP URL construction in both client and server to leverage this optimization - Improved span context handling by storing trace ID, span ID, and parent span ID as separate attributes rather than a single concatenated string These optimizations significantly improve performance in high load scenarios: - Up to 3.24% higher throughput in maximum load tests - Up to 57.75% lower latency at P99.9 under constant high rate (50k req/sec) - Substantial improvements across all high percentile latencies (P95-P99.999) - Most dramatic gains observed in tail latencies under sustained heavy load === Benchmark Summary === Benchmark Type: wrk2 (constant rate) Old Version: ./nsolid_baseline New Version: ./nsolid_fast_push_string Iterations: 50 Connections: 10 Duration: 60s Rate: 40k req/sec +------------------+-------------+-------------+------------+-----+ | Metric | Old Version | New Version | Difference | Sig | +------------------+-------------+-------------+------------+-----+ | Avg Latency (ms) | 2.58 | 2.34 | N/A | | | P50 Latency (ms) | 1.09 | 1.10 | +0.80% | *** | | P90 Latency (ms) | 2.22 | 2.20 | -0.63% | *** | | P99 Latency (ms) | 3.09 | 2.99 | -3.31% | *** | | Avg Req/Sec | 39,992.50 | 39,992.53 | +0.00% | | +------------------+-------------+-------------+------------+-----+ === Benchmark Summary === Benchmark Type: wrk2 (constant rate) Old Version: ./nsolid_baseline New Version: ./nsolid_fast_push_string Iterations: 50 Connections: 10 Duration: 60s Rate: 50k req/sec +------------------+-------------+-------------+------------+-----+ | Metric | Old Version | New Version | Difference | Sig | +------------------+-------------+-------------+------------+-----+ | Avg Latency (ms) | 9.92 | 5.20 | N/A | | | P50 Latency (ms) | 0.95 | 0.94 | -0.54% | | | P90 Latency (ms) | 2.54 | 2.35 | -7.47% | *** | | P99 Latency (ms) | 12.00 | 5.58 | -53.49% | *** | | Avg Req/Sec | 49,990.78 | 49,990.72 | -0.00% | | +------------------+-------------+-------------+------------+-----+ === Benchmark Summary === Benchmark Type: wrk (maximum throughput) Old Version: ./nsolid_baseline New Version: ./nsolid_fast_push_string Iterations: 50 Connections: 10 Duration: 60s Threads: 2 +------------------+-------------+-------------+------------+-----+ | Metric | Old Version | New Version | Difference | Sig | +------------------+-------------+-------------+------------+-----+ | Avg Latency (ms) | 0.65 | 0.64 | N/A | | | P50 Latency (ms) | 0.17 | 0.16 | -3.48% | *** | | P90 Latency (ms) | 0.33 | 0.32 | -2.30% | *** | | P99 Latency (ms) | 0.36 | 0.35 | -3.33% | *** | | Avg Req/Sec | 52,398.20 | 54,094.55 | +3.24% | *** | +------------------+-------------+-------------+------------+-----+
cef497d to
17c1fe8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.